<?php

namespace app\studentLayer\controller;

use think\Controller;

class Jielong extends Controller
{

    public function Jielong()
    {


        return view('/JielongView/Jielong');
    }


    //用来传递API的
    public function ajaxJielong()
    {

        $params = $this->request->get();
        $key = "c4cd9b843f82bba1254cc7b770a3ef00";
        $params['key'] = $key;

//        var_dump($params);die;

        $url = "http://apis.juhe.cn/idiomJie/query?wd=".$params['wd']."&size=".$params['size']."&key=". $params['key'];

        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
     //   curl_setopt($curl, CURLOPT_HEADER, 1);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);//千万不要忘记加上去，不然json字符串后面会多了个1



        $data = curl_exec($curl);
        curl_close($curl);
        $data = json_encode($data);

        echo json_decode($data);die;


    }


}